package com.zy.dp.bridge.example3;

public abstract class AbstractMessage2
{
	protected MessageImplementor getImpl(String message)
	{
		MessageImplementor impl = null;
		if (message == null)
		{

			impl = new MessageSMS();
		}
		else if (message.length() < 100)
		{

			impl = new MessageMobile();
		}
		else if (message.length() < 1000)
		{

			impl = new MessageSMS();
		}
		else
		{

			impl = new MessageEmail();
		}
		return impl;
	}

	public AbstractMessage2()
	{

	}

	public void sendMessage(String message, String toUser)
	{
		this.getImpl(message).send(message, toUser);
	}

}
